﻿using System;
using System.Configuration;
using SMSGateway.Common;

namespace SMSGateway.Entities.Utils
{
    public class MyConfig
    {
        public string rptAuthenFail;
        public string rptSuccessful;
        public string rptStructureError;
        public string Suport;

        public string rptDataPrice;
        public string PhoneSuport1;
        public string PhoneSuport2;

        public string KeyWord;
        public string rvUserName;
        public string rvPassword;
        public string CustomerID;
        public string ServiceNumber;
        public string ServiceName;

        public string urlWorldGold;
        public string urlVNGold;
        public string urlSJCGold;
        public string urlBTMCGold;
        public string urlSBJGold;
        public int MaximumLengthSMSofGold;

        public MyConfig()
        {
            this.rptAuthenFail = "";
            this.rptSuccessful = "";
            this.rptStructureError = "";
            this.Suport = "";

            this.rptDataPrice = "";
            this.PhoneSuport1 = "";
            this.PhoneSuport2 = "";

            this.KeyWord = "";
            this.rvUserName = "";
            this.rvPassword = "";
            this.CustomerID = "";
            this.ServiceNumber = "";
            this.ServiceName = "";

            this.urlWorldGold = "";
            this.urlVNGold = "";
            this.urlSJCGold = "";
            this.urlBTMCGold = "";
            this.urlSBJGold = "";
            this.MaximumLengthSMSofGold = 0;
        }

        public bool GetMyConfig()
        {
            try
            {
                this.rptAuthenFail = ConfigurationManager.AppSettings["rptAuthenFail"].ToString();
                this.rptSuccessful = ConfigurationManager.AppSettings["rptSuccessful"].ToString();
                this.rptStructureError = ConfigurationManager.AppSettings["rptStructureError"].ToString();
                this.Suport = ConfigurationManager.AppSettings["Suport"].ToString();

                this.rptDataPrice = ConfigurationManager.AppSettings["rptDataPrice"].ToString();
                this.PhoneSuport1 = ConfigurationManager.AppSettings["PhoneSuport1"].ToString();
                this.PhoneSuport2 = ConfigurationManager.AppSettings["PhoneSuport2"].ToString();

                this.KeyWord = ConfigurationManager.AppSettings["KeyWord"].ToString();
                this.rvUserName = ConfigurationManager.AppSettings["rvUserName"].ToString();
                this.rvPassword = ConfigurationManager.AppSettings["rvPassword"].ToString();
                this.CustomerID = ConfigurationManager.AppSettings["CustomerID"].ToString();
                this.ServiceNumber = ConfigurationManager.AppSettings["ServiceNumber"].ToString();
                this.ServiceName = ConfigurationManager.AppSettings["ServiceName"].ToString();

                this.urlWorldGold = ConfigurationManager.AppSettings["urlWorldGold"].ToString();
                this.urlVNGold = ConfigurationManager.AppSettings["urlVNGold"].ToString();
                this.urlSJCGold = ConfigurationManager.AppSettings["urlSJCGold"].ToString();
                this.urlBTMCGold = ConfigurationManager.AppSettings["urlBTMCGold"].ToString();
                this.urlSBJGold = ConfigurationManager.AppSettings["urlSBJGold"].ToString();
                this.MaximumLengthSMSofGold = Int32.Parse(ConfigurationManager.AppSettings["MaximumLengthSMSofGold"].ToString());
                return true;
            }
            catch (Exception ex)
            {
                Logger.Error("GetMyConfig Error ! ", ex);
                throw;
            }
        }
    }
}
